package com.xuexiang.xuidemo.app.fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import com.xuexiang.xui.widget.actionbar.TitleBar;
import com.xuexiang.xui.widget.imageview.ImageLoader;
import com.xuexiang.xui.widget.imageview.RadiusImageView;
import com.xuexiang.xuidemo.R;
import com.xuexiang.xuidemo.base.BaseFragment;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link TestingGif#newInstance} factory method to
 * create an instance of this fragment.
 */
public class TestingGif extends BaseFragment {

    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "gifUrl";

    private String mGifUrl;

    private RadiusImageView imageView;

    public TestingGif() {
        // Required empty public constructor
    }


    public static TestingGif newInstance(String gifUrl) {
        TestingGif fragment = new TestingGif();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, gifUrl);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mGifUrl = getArguments().getString(ARG_PARAM1);
        }
    }

    @Override
    protected int getLayoutId() {
        return R.layout.app_fragment_testing_gif;
    }

    @Override
    protected void initViews() {
        imageView = findViewById(R.id.word_image);
        ImageLoader.get().loadImage(imageView, mGifUrl);
    }

    @Override
    protected TitleBar initTitle() {
        return null;
    }
}